﻿using ShenNius.BaseControllers.Models;
using SqlSugar;
using System;

/*************************************
* 类名：Common
* 作者：realyrare
* 邮箱：mhg215@yeah.net
* 时间：2021/3/30 17:24:54
*┌───────────────────────────────────┐　    
*│　     版权所有：神牛软件　　　　	 │
*└───────────────────────────────────┘
**************************************/

namespace ShenNius.BaseControllers.Models
{
    public interface IEntity
    {
        int Id { get; set; }    
    }

    /// <summary>
    /// 数据实体通用状态
    /// </summary>
    public interface IStatus
    {
        /// <summary>
        /// true为正常，反之亦然
        /// </summary>
      abstract bool Status { get; set; }
    }
    /// <summary>
    /// 非多租户的数据库实体基类
    /// </summary>
    public class BaseEntity :  IEntity
    {
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }
        public DateTime CreateTime { get; set; }

    }

    /// <summary>
    /// 所有多租户数据库实体基类(多租户默认是软删除，实体表数据默认状态由status控制)
    /// </summary>
    public class BaseTenantEntity : IGlobalTenant, IEntity, IStatus
    {
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }
        public int TenantId { get; set; }
        [SugarColumn(IsIgnore = true)]
        public string TenantName { get; set; }
        public DateTime CreateTime { get; set; }
        public bool Status { get; set; }
    }
}